package com.dragon.client.controller.auth;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.client.config.annotation.Login;
import com.dragon.common.model.ResponseData;
import com.dragon.logical.service.auth.IToSendService;
import com.dragon.repository.domain.dto.ToSendDTO;
import com.dragon.repository.entity.ToSend;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 抄送人 前端控制器
 * </p>
 *
 * @author sy
 * @since 2023-07-07
 */
@RestController
@RequestMapping("toSend")
@Api(tags = "抄送管理")
public class ToSendController {

    @Autowired
    IToSendService service;

    @GetMapping("pageList")
    @ApiOperation("抄送人分页列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",required = true,type = "int",value = "页码"),
            @ApiImplicitParam(name = "limit",required = true,type = "int",value = "条数")
    })
    public ResponseData selectPage(@ApiParam(hidden = true) @Login Integer adminId, @RequestParam Integer page, @RequestParam Integer limit){
        Page<ToSend> toSendPage = service.selectPageList(adminId,page,limit);
        return ResponseData.success(ToSendDTO.convertList(toSendPage.getRecords()),toSendPage.getTotal());
    }

}
